package com.yisoo.ubag.app.config;

import com.yisoo.ubag.app.interceptor.LoginUserInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class AppWebConfig implements WebMvcConfigurer {

    @Autowired
    LoginUserInterceptor loginUserInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginUserInterceptor)
                .addPathPatterns("/**")//加入拦截器
                .excludePathPatterns("/app/user/login/**")//排除
                .excludePathPatterns("/app/user/delete/**")//排除
                .excludePathPatterns("/app/user/update/**")//排除
                .excludePathPatterns("/app/user/save/**")//排除
                .excludePathPatterns("/app/user/info/**")//排除
                .excludePathPatterns("/app/user/list/**")//排除
                .excludePathPatterns("/app/order/no/**")//排除 营收管理的数据
                .excludePathPatterns("/app/test/**")//排除 测试
                .excludePathPatterns("/swagger-ui.html","/swagger-resources/**","/v2/api-docs/**","/webjars/springfox-swagger-ui/**");
    }
}
